package com.mika.music.model;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

@Data
public class Comment {
    // 评论表
    private Integer id;
    private Integer userId;
    private String userName;
    private Integer musicId;
    private String musicName;
    private String message;
    private Integer deleteFlag;
    private Date createTime;
    private Date updateTime;

    public Comment() {
    }

    public String getCreateTime() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        // 使日期按照地区显示，这样才能够得到准确的时间
        TimeZone zone = TimeZone.getTimeZone("MST");
        simpleDateFormat.setTimeZone(zone);
        return simpleDateFormat.format(createTime);
    }

    public Comment(Integer userId, Integer musicId, String message) {
        this.userId = userId;
        this.musicId = musicId;
        this.message = message;
    }
}
